﻿using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using Lswweb.Domain;
using Lswweb.Model;

namespace Lswweb.Controls
{
    /// <summary>
    /// map路径指向控件“面包屑”
    /// </summary>
    public class Breadcrumb : Control
    {
        private string title=string.Empty;
        private string split = " > ";

        protected override void Render(HtmlTextWriter writer)
        {
            string path=string.IsNullOrEmpty(MapNodeKey)?Maps.Content.GetPathText(true,Split,Type):Maps.Content.GetPathText(false,MapNodeKey,split,Type);
            if (!string.IsNullOrEmpty(Format))
                path = string.Format(ResourceManagement.Content.Strings[Format], path);

            writer.Write(path);
        }

        /// <summary>
        /// Resource.xml 中的name值
        /// </summary>
        public string Format { get; set; }

        public string MapNodeKey { get; set; }

        public string Split
        {
            get { return split; }
            set { split = value; }
        }

        public MapType Type { get; set; }
    }
}
